﻿using Sunny.UI;
using System;
using System.Windows.Forms;
using 纺织贸易管理系统;

namespace PrintLabel.View
{
    public partial class SelectEmployer  : AntdUI.Window 
    {
        public string Employer { get; set; } =  string.Empty;
        public SelectEmployer()
        {
            InitializeComponent();
        }

        private void SelectStockname_Load(object sender, EventArgs e)
        {
            CreateStockBtn();
        }
        private void CreateStockBtn()
        {
            var stocknames = dbContext.dbcontext.Queryable<YuanGongTable>().Where(x=>x.Department=="质检部"&&x.ISDimission==false).ToList();
            foreach (var item in stocknames)
            {
                var btn = new UIButton() { Width = 100, Height = 60 };
                btn.Text = item.Xingming ;
                btn.Click += Btn_Click;
                flowLayoutPanel1.Controls.Add(btn);
            }
            var btn1 = new UIButton() { Width = 100, Height = 60 };
            btn1.Text ="零时工";
            btn1.Click += Btn_Click;
            flowLayoutPanel1.Controls.Add(btn1);
        }
        private void Btn_Click(object sender, EventArgs e)
        {
            var btn = sender as UIButton;
            this.Employer = btn.Text;
            this.Close();
        }
    }
}
